package com.zeei.pls.vo;

import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.zeei.common.vo.TreeNodeVO;

/****
 * T_PS_BAS_ENTERLIST，
 * 排污单位基本信息
 * 污染源基本信息
 * @author YuZhending
 *
 */
public class CompanyVO extends TreeNodeVO<CompanyVO> {
	/** 单位ID, 污染源编号， PSCODE, pollutant source code */
	private int companyId;
	
	/** 区域编码,  */
	private String regionCode;
	
	/** 标准污染源编号，STDPSCODE, standard **/
	private String standardPSCode;
	
	/** 单位名称，ENTERNAME  */
	private String companyName;
	
	/** 企业简称 **/
	private String companyShortName;

	/** 注册地址， REGISTER_ADDRESS **/
	private String registerAddress;

	/** 邮政编码，POSTALCODE  **/
	private String postalCode;

	/** 经营场所，ENTERADDRESS **/
	private String productionAddress;

	/** 行业类别，CODE_TRADE **/
	private String tradeCode;

	/** 投产日期，PRODUCTDATE **/
	private Date productionDate;

	/** LONGITUDE **/
	private String longitude;

	/** LATITUDE **/
	private String latitude;

	/** 组织机构代码，ORGANIZATIONCODE **/
	private String companyCode;

	/** CREDITCODE **/
	private String creditCode;

	/** 技术负责人，TECHLEADER **/
	private String techleaderName;

	/** ISKEYAREA **/
	private String isKeyArea;

	/** 主要污染源类别，PRIMARY_POLLTYPE **/
	private String primaryType;

	/** 废气主要污染物种类，GAS_POLLUTES **/
	private String gasType;

	/** 废气主要污染物排放形式，GAS_EMISSION_FORM **/
	private String gasForm;

	/** 废气标准，GAS_STANDARD_NAME **/
	private String gasStandard;

	/** 废水主要污染物种类，GAS_POLLUTES **/
	private String waterType;

	/** 废水排放形式，WAT_EMISSION_FORM **/
	private String waterForm;

	/** 废水标准，WAT_STANDARD_NAME **/
	private String waterStandard;
	
	/** 法定代表人 **/
	private String legalPerson;

	/** 联系电话，LINKTEL **/
	private String usualPhone;
	
	/** 固定电话 **/
	private String fixedPhone;
	
	/** 移动电话 **/
	private String mobilePhone;
	
	public int getCompanyId() {
		return companyId;
	}

	public void setCompanyId(int companyId) {
		this.companyId = companyId;
	}

	public String getRegionCode() {
		return regionCode;
	}

	public void setRegionCode(String regionCode) {
		this.regionCode = regionCode;
	}

	public String getStandardPSCode() {
		return standardPSCode;
	}

	public void setStandardPSCode(String standardPSCode) {
		this.standardPSCode = standardPSCode;
	}

	public String getCompanyName() {
		return companyName;
	}

	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	public String getCompanyShortName() {
		return companyShortName;
	}

	public void setCompanyShortName(String companyShortName) {
		this.companyShortName = companyShortName;
	}

	public String getRegisterAddress() {
		return registerAddress;
	}

	public void setRegisterAddress(String registerAddress) {
		this.registerAddress = registerAddress;
	}

	public String getPostalCode() {
		return postalCode;
	}

	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}

	public String getProductionAddress() {
		return productionAddress;
	}

	public void setProductionAddress(String productionAddress) {
		this.productionAddress = productionAddress;
	}

	public String getTradeCode() {
		return tradeCode;
	}

	public void setTradeCode(String tradeCode) {
		this.tradeCode = tradeCode;
	}

	public Date getProductionDate() {
		return productionDate;
	}

	public void setProductionDate(Date productionDate) {
		this.productionDate = productionDate;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public String getCompanyCode() {
		return companyCode;
	}

	public void setCompanyCode(String companyCode) {
		this.companyCode = companyCode;
	}

	public String getCreditCode() {
		return creditCode;
	}

	public void setCreditCode(String creditCode) {
		this.creditCode = creditCode;
	}

	public String getTechleaderName() {
		return techleaderName;
	}

	public void setTechleaderName(String techleaderName) {
		this.techleaderName = techleaderName;
	}

	public String getIsKeyArea() {
		return isKeyArea;
	}

	public void setIsKeyArea(String isKeyArea) {
		this.isKeyArea = isKeyArea;
	}

	public String getPrimaryType() {
		return primaryType;
	}

	public void setPrimaryType(String primaryType) {
		this.primaryType = primaryType;
	}

	public String getGasType() {
		return gasType;
	}

	public void setGasType(String gasType) {
		this.gasType = gasType;
	}

	public String getGasForm() {
		return gasForm;
	}

	public void setGasForm(String gasForm) {
		this.gasForm = gasForm;
	}

	public String getGasStandard() {
		return gasStandard;
	}

	public void setGasStandard(String gasStandard) {
		this.gasStandard = gasStandard;
	}

	public String getWaterType() {
		return waterType;
	}

	public void setWaterType(String waterType) {
		this.waterType = waterType;
	}

	public String getWaterForm() {
		return waterForm;
	}

	public void setWaterForm(String waterForm) {
		this.waterForm = waterForm;
	}

	public String getWaterStandard() {
		return waterStandard;
	}

	public void setWaterStandard(String waterStandard) {
		this.waterStandard = waterStandard;
	}

	public String getLegalPerson() {
		return legalPerson;
	}

	public void setLegalPerson(String legalPerson) {
		this.legalPerson = legalPerson;
	}

	public String getUsualPhone() {
		return usualPhone;
	}

	public void setUsualPhone(String usualPhone) {
		this.usualPhone = usualPhone;
	}

	public String getFixedPhone() {
		return fixedPhone;
	}

	public void setFixedPhone(String fixedPhone) {
		this.fixedPhone = fixedPhone;
	}

	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}
	
	public boolean isValidLongitude() {
		if(longitude == null || longitude.isEmpty()) {
			return false;
		}
		return isValidFloat(longitude);
	}
	
	public boolean isValidLatitude() {
		if(latitude == null || latitude.isEmpty()) {
			return false;
		}
		return isValidFloat(latitude);
	}
	
	public boolean isValidLocation() {
		return isValidLongitude() && isValidLatitude();
	}
	
	private boolean isValidFloat(String value) {
		String regex = "(-?\\d+|-?\\d+\\.\\d*|-?\\d*\\.\\d+)";
		Matcher m = Pattern.compile(regex, Pattern.CASE_INSENSITIVE).matcher(value);

		return m.matches();
	}
}